<template>
  <div>
    <!-- 面包屑 -->
    <cs-bread>{{ $route.meta.title }}</cs-bread>
    <!-- 查询功能 -->
    <el-form :inline="true" :model="searchFrom" class="demo-form-inline">
      <el-form-item>
        <el-input v-model="searchFrom.user" placeholder="用户名"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="searchFrom.phone" placeholder="手机号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select
          v-model="searchFrom.sex"
          placeholder="性别"
          style="width: 100px;"
        >
          <el-option label="男" value="男"></el-option>
          <el-option label="女" value="女"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="success">查询</el-button>
        <el-button type="danger">重置</el-button>
        <el-button type="primary">新增</el-button>
      </el-form-item>
    </el-form>
    <!-- 表格 -->
    <el-table :data="tableData" border style="width: 100%;margin-bottom: 20px;" :stripe="true">
      <el-table-column prop="name" label="姓名" width="120"> </el-table-column>
      <el-table-column prop="phone" label="手机号" width="200">
      </el-table-column>
      <el-table-column prop="sex" label="性别" width="80"> </el-table-column>
      <el-table-column prop="birthday" label="生日" width="200">
      </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
      <el-table-column prop="operation" label="操作">
        <el-button type="primary" size="small">编辑</el-button>
        <el-button type="danger" size="small">删除</el-button>
      </el-table-column>
    </el-table>
    <!-- 分页器 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
    >
    </el-pagination>
  </div>
</template>

<script>
import csBread from "@/components/Bread";
export default {
  data() {
    return {
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      searchFrom: {
        user: "",
        phong: "",
        sex: ""
      },
      tableData: [
        {
          id: 1,
          name: "王小虎",
          phone: "13426265577",
          sex: "男",
          birthday: "1998-05-09",
          address: "地址"
        },
        {
          id: 2,
          name: "王小虎",
          phone: "13426265577",
          sex: "男",
          birthday: "1998-05-09",
          address: "地址"
        },
        {
          id: 3,
          name: "王小虎",
          phone: "13426265577",
          sex: "男",
          birthday: "1998-05-09",
          address: "地址"
        },
        {
          id: 4,
          name: "王小虎",
          phone: "13426265577",
          sex: "男",
          birthday: "1998-05-09",
          address: "地址"
        },
        {
          id: 5,
          name: "王小虎",
          phone: "13426265577",
          sex: "男",
          birthday: "1998-05-09",
          address: "地址"
        }
      ]
    };
  },

  components: { csBread },

  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
};
</script>

<style scoped>
.el-form-item__content {
  width: 60px;
}
</style>